import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class text {

    public static void main(String[] args) {
        Student student = new Student("22022401431");
        Student student1 = new Student("22022401432");

        System.out.println(student.hashCode());
        System.out.println(student1.hashCode());

        HashMap<Student,Integer> map = new HashMap<>();
        map.put(student,2);
        System.out.println(map.get(student));
    }

    public static void main3(String[] args) {
        HashBuck hashBuck = new HashBuck();
        hashBuck.put(0,1);
        hashBuck.put(1,1124);
        hashBuck.put(2,11234);
        hashBuck.put(3,12346);
        hashBuck.put(4,115);
        hashBuck.put(5,18745);
        hashBuck.put(6,19326);
        hashBuck.put(7,1247);
        hashBuck.put(8,1845);
        hashBuck.put(9,117543);
        hashBuck.put(10,1247);
        hashBuck.put(11,114514);
        hashBuck.put(12,1215);
        hashBuck.put(13,1156);
        hashBuck.put(14,17427);
        hashBuck.put(15,1497);

        hashBuck.show();
        System.out.println(hashBuck.use_size);
        System.out.println(hashBuck.array.length);
    }
    public static void main2(String[] args) {
//        map_set
        TreeMap<String, Integer> map = new TreeMap<>();  //O(logN)
        map.put("swj", 4);
        map.put("xxd", 3);
        map.put("xsc", 2);

        System.out.println(map.get("swj"));  // 获取元素对应的key
        System.out.println(map.getOrDefault("swj", 99999));//如果没有，返回指定的的默认值

        Set<String> set = map.keySet();
        System.out.println(set);  //返回所有key的不重复集合

        Set<Map.Entry<String,Integer>> set1 = map.entrySet();
        System.out.println(set1);

        HashMap<String, Integer> map1 = new HashMap<>(); //哈希表：由数组 链表 + 红黑树组成的

    }

    public static void main1(String[] args) {
        int[] array = {1, 3, 5, 7, 9, 2, 4, 6, 8, 10};
        BinarySearchTree binarySearchTree = new BinarySearchTree();
        for (int j : array) {
            binarySearchTree.Insert(j);
        }

//        System.out.println(binarySearchTree.Search(100));
//        System.out.println(binarySearchTree.Search(10));
//        System.out.println(binarySearchTree.Search(1));

//        System.out.println(binarySearchTree.Modify(1, 100));

        binarySearchTree.delete(7);
    }

}
